#ifndef CHESS_PIECE
#define CHESS_PIECE

#include "board.hpp"

// 具体棋子
class King: public ChessPiece {
public:
    King(Camp camp): ChessPiece(Type::KING, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
private:
    bool is_valid(const int x, const int y) const;
};

class Rock: public ChessPiece {
public:
    Rock(Camp camp): ChessPiece(Type::ROCK, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
};

class Cannon: public ChessPiece {
public:
    Cannon(Camp camp): ChessPiece(Type::CANNON, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
};

class Knight: public ChessPiece {
public:
    Knight(Camp camp): ChessPiece(Type::KNIGHT, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
};

class Guard: public ChessPiece {
public:
    Guard(Camp camp): ChessPiece(Type::GUARD, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
private:
    bool is_valid(const int x, const int y) const;
};

class Bishop: public ChessPiece {
public:
    Bishop(Camp camp): ChessPiece(Type::BISHOP, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
private:
    bool is_valid(const int x, const int y) const;
};

class Pawn: public ChessPiece {
public:
    Pawn(Camp camp): ChessPiece(Type::PAWN, camp) {}
    virtual std::vector<Move> available_move(const Board &board, const Location loc) const override;
    virtual std::shared_ptr<ChessPiece> clone() const override;
};

#endif